package com.example.app;

import android.app.Application;

public class MainApplication extends Application {
    private final Runnable runnable = () -> MqttUtil.getInstance(this).connect();

    @Override
    public void onCreate() {
        super.onCreate();
        Object mqttUtil = MqttUtil.getInstance(this);
        WifiUtil.getInstance().initialize(getApplicationContext());
        SPUtil.getInstance().initialize(getApplicationContext());
        //MqttUtil.getInstance().connect();
        ThreadUtil.scheduleAtFixedRate(runnable, 0, 1500);
    }

    @Override
    public void onTrimMemory(int level) {
        super.onTrimMemory(level);
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
        MqttUtil.getInstance(this).destroy();
    }
}